import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
// 扩展插件 utc
dayjs.extend(utc)

const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'

export function formatUtcString(
  utc: string,
  format: string = DATE_TIME_FORMAT
): string {
  // utcOffset(8) 东八区北京时间
  return dayjs.utc(utc).utcOffset(8).format(format)
}
